package com.ityunhe.dao.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.session.SqlSession;

import com.ityunhe.bean.Garden;
import com.ityunhe.bean.Goods;
import com.ityunhe.bean.Goodsclasses;
import com.ityunhe.bean.Page;
import com.ityunhe.dao.GoodsShowDao;
import com.ityunhe.factory.MybatisUtil;

public class GoodsShowDaoImpl implements GoodsShowDao {

	@Override
	public Goods getGoods(Goods goods) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Goods> listGoods() {
		// TODO Auto-generated method stub
		return null;
	}

	
	@Override
	public List<Goodsclasses> listGoodClassDepth(int depth) {
		// TODO Auto-generated method stub
		List<Goodsclasses>  listGoodClassDepth=null;
		SqlSession session = MybatisUtil.getSession();
		GoodsShowDao mapper = session.getMapper(GoodsShowDao.class);
		listGoodClassDepth = mapper.listGoodClassDepth(depth);
		MybatisUtil.closeSession();
		return listGoodClassDepth;
	}

	
	/**
	 * map 提供index pagesize  条件 gaid  gsid
	 */
	@Override
	public List<Map> listGoodsPage(Map<String, Object> map) {
		//map里面的存放有 查询条件gsid  gaid pageIndex  Pages
		// TODO Auto-generated method stub
		SqlSession session = MybatisUtil.getSession();
		GoodsShowDao mapper = session.getMapper(GoodsShowDao.class);
		List<Map> listGoods = (List<Map>) mapper.listGoodsPage(map);
		MybatisUtil.closeSession();
		return listGoods;
	}

	@Override
	public int countList(Map<String ,Object> map) {
		// TODO Auto-generated method stub
		int count=0;
		SqlSession session = MybatisUtil.getSession();
		GoodsShowDao mapper = session.getMapper(GoodsShowDao.class);
		count = mapper.countList(map);
		MybatisUtil.closeSession();
		return count ;
	}

	@Override
	public List<Garden> listGardens() {
		// TODO Auto-generated method stub
		List<Garden> list = new ArrayList<Garden>();
		SqlSession session = MybatisUtil.getSession();
		GoodsShowDao mapper = session.getMapper(GoodsShowDao.class);
		list = mapper.listGardens();
		MybatisUtil.closeSession();
		return list;
	}

}
